const Koa = require('koa')
const fs = require('fs')
const app = new Koa()

// 异步中间件
const main = async function(ctx) {
  ctx.response.type = 'html'
  ctx.response.body = await fs.readFileSync('./template.html', 'utf-8')
}

app.use(main)

app.listen(3000)